<template>
  <div>
    <!-- 面包屑导航区 -->
    <el-breadcrumb>
      <el-breadcrumb-item :to="{ path: '/home' }">首页</el-breadcrumb-item>
      <el-breadcrumb-item>权限管理</el-breadcrumb-item>
      <el-breadcrumb-item>权限列表</el-breadcrumb-item>
    </el-breadcrumb>
    <!-- 卡片视图 -->
    <el-card >
      <el-table :data="rightsList" style="width: 100%" border stripe resizable height='500px' align='center'>
        <el-table-column type = "index" label="序号" width="50" align='center'></el-table-column>
        <el-table-column  label="权限说明" prop="authName" align='center'></el-table-column>
        <el-table-column  label="路径" prop="path" align='center'></el-table-column>
        <el-table-column  label="权限等级" prop="level" align='center'>
          <template slot-scope="scope">
            <!-- <el-tag>{{scope.row.level}}</el-tag> -->
            <el-tag v-show="scope.row.level === '0'">一级</el-tag>
            <el-tag type="success" v-show="scope.row.level === '1'">二级</el-tag>
            <el-tag type="warning" v-show="scope.row.level === '2'">三级</el-tag>
          </template>
        </el-table-column>
      </el-table>
    </el-card>
  </div>
</template>

<script>
export default {
  data () {
    return {
      rightsList: []
    }
  },
  methods: {
    async getRightsList () {
      const { data: res } = await this.$http.get('rights/list')
      if (res.meta.status !== 200) {
        this.$message.error(res.meta.msg)
      }
      console.log(res)
      this.rightsList = res.data
    }
  },
  mounted () {
    this.getRightsList()
  }
}
</script>

<style>

</style>
